
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>使用Reactive Streams与JUC提升应用性能 - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>使用Reactive Streams与JUC提升应用性能 - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">为什么现代高并发系统需要使用 Reactive Streams 而不是传统的同步阻塞模型？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">因为传统的同步阻塞模型在高并发、高吞吐量系统中会导致线程资源被快速耗尽，系统性能急剧下降。而 Reactive Streams 采用异步非阻塞的编程范式，能显著提升系统的吞吐量和响应速度。</div>
          </div>
          <div class="card-source">来源: 一、引言：为什么需要Reactive Streams？</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">Reactive Streams 规范定义了哪四个核心接口？它们各自的角色是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Reactive Streams 定义了四个核心接口：1. Publisher：数据发布者；2. Subscriber：数据订阅者；3. Subscription：代表订阅关系；4. Processor：既是 Publisher 又是 Subscriber。</div>
          </div>
          <div class="card-source">来源: 2.1 什么是Reactive Streams？</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">Reactive Streams 中的“背压控制 (Backpressure)”机制起什么作用？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">背压控制允许订阅者(Subscriber)控制数据流的速度，从而避免数据生产者(Publisher)发送数据的速度过快而压垮消费者。</div>
          </div>
          <div class="card-source">来源: 2.2 核心概念</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">根据文档，Reactive Streams 与传统同步模型在线程模型和背压支持上有何关键区别？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">主要区别在于：1. 线程模型：Reactive Streams 是非阻塞的，而传统模型是阻塞的。2. 背压支持：Reactive Streams 内置了背压支持，而传统模型没有。</div>
          </div>
          <div class="card-source">来源: 2.3 Reactive Streams vs 传统同步模型</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">JUC (Java Util Concurrent) 提供了哪些常见的并发集合，并简述其适用场景？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">文档中提到了三种：1. ConcurrentHashMap：适用于高并发场景的 Map；2. CopyOnWriteArrayList：适用于读多写少的 List；3. BlockingQueue：用于实现阻塞队列。</div>
          </div>
          <div class="card-source">来源: 3.2 并发集合</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">在 Reactive Streams 与 JUC 的结合中，Subscription 机制和 JUC 的 BlockingQueue 分别扮演什么角色来实现背压控制？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Reactive Streams 通过 Subscription 机制来实现背压控制，而 JUC 的 BlockingQueue 可以作为生产者和消费者之间的缓冲区。</div>
          </div>
          <div class="card-source">来源: 4.2 背压控制</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">模式</div>
          <div class="card-question">文档中提到了三种 Reactor 模式，其中 Netty 框架采用的是哪一种？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">模式</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Netty 采用的是“主从Reactor多线程”设计模式。</div>
          </div>
          <div class="card-source">来源: 7.1 Reactor模式</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">实践</div>
          <div class="card-question">在使用 Reactive Streams 和 JUC 时，有哪些常见的陷阱需要避免？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">实践</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">需要避免三个常见陷阱：1. 回调地狱（过度嵌套回调）；2. 线程泄漏（未正确关闭线程池）；3. 背压失控（未正确处理背压导致系统崩溃）。</div>
          </div>
          <div class="card-source">来源: 8.3 常见陷阱</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">实践</div>
          <div class="card-question">在高性能订单处理系统的案例中，提到了哪些性能优化点？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">实践</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">提到了三个性能优化点：1. 线程池调优：根据任务类型调整线程池大小；2. 缓存优化：使用缓存（如Caffeine）来缓存计算结果；3. 批量处理：合并请求以减少远程调用次数。</div>
          </div>
          <div class="card-source">来源: 5.4 性能优化点</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
